package com.wondersgroup.wuhan_demo.ui;

import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;

import com.wondersgroup.wuhan_demo.MyApplication;
import com.wondersgroup.wuhan_demo.R;
import com.wondersgroup.wuhan_demo.base.BaseFragment;
import com.wondersgroup.wuhan_demo.util.SPUtils;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;

public class YySureFragment extends BaseFragment {
    // TODO: Rename parameter arguments, choose names that match
    // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
    private static final String ARG_PARAM1 = "param1";
    private static final String ARG_PARAM2 = "param2";
    @BindView(R.id.tv_sfzhm)
    TextView tvSfzhm;
    @BindView(R.id.tv_xm)
    TextView tvXm;
    @BindView(R.id.tv_xb)
    TextView tvXb;
    @BindView(R.id.tv_ks)
    TextView tvKs;
    @BindView(R.id.tv_ys)
    TextView tvYs;
    @BindView(R.id.tv_money)
    TextView tvMoney;
    @BindView(R.id.btn_sure_fk)
    Button btnSureFk;
    Unbinder unbinder;

    // TODO: Rename and change types of parameters
    private String deptName;
    private String doctorName;


    public YySureFragment() {
        // Required empty public constructor
    }

    // TODO: Rename and change types and number of parameters
    public static YySureFragment newInstance(String deptName, String doctorName) {
        YySureFragment fragment = new YySureFragment();
        Bundle args = new Bundle();
        args.putString(ARG_PARAM1, deptName);
        args.putString(ARG_PARAM2, doctorName);
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (getArguments() != null) {
            deptName = getArguments().getString(ARG_PARAM1);
            doctorName = getArguments().getString(ARG_PARAM2);
            MyApplication.deptName = deptName;
            MyApplication.doctorName = doctorName;
        }
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.fragment_yy_sure, container, false);
        unbinder = ButterKnife.bind(this, view);
        Log.i("dddddddddddd","dddd");
        String kh= (String) SPUtils.get(getContext(),getString(R.string.kh),"");
        String xm= (String) SPUtils.get(getContext(),getString(R.string.xm),"");
        String xb= (String) SPUtils.get(getContext(),getString(R.string.xb),"");
        tvSfzhm.setText(kh);
        tvXm.setText(xm);
        tvXb.setText(xb);
        tvMoney.setText("0.01元");
        tvKs.setText(deptName);
        tvYs.setText(doctorName);
        return view;
    }

    @Override
    public void onResume() {
        super.onResume();
        LaunchActivity launchActivity=(LaunchActivity)getActivity();
        launchActivity.setTopPosition(4);
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }

    @OnClick(R.id.btn_sure_fk)
    public void onViewClicked() {
        addFragment(new PayFragment());
    }
}
